<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LQ AI管理平台</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }
        
        :root {
            --bg-primary: #0a0a0a;
            --bg-secondary: #1a1a1a;
            --bg-tertiary: #2a2a2a;
            --accent-primary: #00d4ff;
            --accent-secondary: #ff6b6b;
            --text-primary: #ffffff;
            --text-secondary: #b0b0b0;
            --text-muted: #666666;
            --border-color: #333333;
            --shadow-color: rgba(0, 212, 255, 0.1);
            --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            --gradient-secondary: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            --gradient-tertiary: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
        }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: var(--bg-primary);
            color: var(--text-primary);
            overflow-x: hidden;
        }
        
        /* 动态背景 */
        body::before {
            content: '';
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: 
                radial-gradient(circle at 20% 80%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(255, 107, 107, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 40% 40%, rgba(102, 126, 234, 0.1) 0%, transparent 50%);
            animation: backgroundShift 20s ease-in-out infinite;
            z-index: -1;
        }
        
        @keyframes backgroundShift {
            0%, 100% { transform: scale(1) rotate(0deg); }
            50% { transform: scale(1.1) rotate(180deg); }
        }
        
        .app-container {
            display: flex;
            height: 100vh;
        }
        
        /* 侧边栏样式 */
        .sidebar {
            width: 280px;
            height: 100vh;
            background: rgba(26, 26, 26, 0.95);
            backdrop-filter: blur(20px);
            border-right: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            position: relative;
            overflow: hidden;
            transition: width 0.3s ease;
        }
        
        .sidebar.collapsed {
            width: 70px;
        }
        
        .sidebar::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(180deg, rgba(0, 212, 255, 0.05) 0%, transparent 100%);
            z-index: 0;
        }
        
        .sidebar-header {
            padding: 30px 20px;
            border-bottom: 1px solid var(--border-color);
            position: relative;
            z-index: 1;
        }
        
        .logo {
            display: flex;
            align-items: center;
            gap: 15px;
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text-primary);
        }
        
        .logo i {
            font-size: 2rem;
            background: var(--gradient-tertiary);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .sidebar-nav {
            flex: 1;
            padding: 20px 0;
            position: relative;
            z-index: 1;
        }
        
        .nav-item {
            display: flex;
            align-items: center;
            gap: 15px;
            padding: 15px 25px;
            margin: 5px 15px;
            border-radius: 12px;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .nav-item::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: var(--gradient-primary);
            transition: left 0.3s ease;
            z-index: -1;
        }
        
        .nav-item:hover::before,
        .nav-item.active::before {
            left: 0;
        }
        
        .nav-item:hover {
            color: white;
            transform: translateX(5px);
        }
        
        .nav-item.active {
            color: white;
            background: rgba(0, 212, 255, 0.1);
            border: 1px solid rgba(0, 212, 255, 0.3);
        }
        
        .nav-item i {
            font-size: 1.2rem;
            width: 20px;
            text-align: center;
        }
        
        .nav-item span {
            font-weight: 500;
        }
        
        .sidebar-footer {
            padding: 20px;
            border-top: 1px solid var(--border-color);
            position: relative;
            z-index: 1;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .user-info {
            display: flex;
            align-items: center;
            gap: 10px;
            color: var(--text-secondary);
        }
        
        .logout-btn {
            background: none;
            border: 1px solid var(--border-color);
            color: var(--text-secondary);
            padding: 8px 12px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .logout-btn:hover {
            background: var(--accent-secondary);
            color: white;
            border-color: var(--accent-secondary);
        }
        
        /* 主内容区域 */
        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }
        
        .content-header {
            padding: 20px 30px;
            border-bottom: 1px solid var(--border-color);
            background: rgba(26, 26, 26, 0.8);
            backdrop-filter: blur(10px);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .page-title {
            font-size: 1.8rem;
            font-weight: 600;
            background: var(--gradient-primary);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }
        
        .header-actions {
            display: flex;
            gap: 10px;
        }
        
        .action-btn {
            background: rgba(42, 42, 42, 0.8);
            border: 1px solid var(--border-color);
            color: var(--text-primary);
            padding: 8px 15px;
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 0.9rem;
        }
        
        .action-btn:hover {
            background: var(--accent-primary);
            border-color: var(--accent-primary);
            color: white;
        }
        
        /* Webview容器 */
        .webview-container {
            flex: 1;
            padding: 20px;
            overflow: hidden;
        }
        
        /* 响应式设计 */
        @media (max-width: 768px) {
            .sidebar {
                width: 70px;
            }
            
            .sidebar .logo span,
            .sidebar .nav-item span,
            .sidebar .user-info span {
                display: none;
            }
            
            .content-header {
                padding: 15px 20px;
            }
            
            .page-content {
                padding: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="app-container">
        <!-- 侧边栏容器 -->
        <div id="sidebar-container"></div>
        
        <!-- 主内容区域 -->
        <div class="main-content">
        
            
            <!-- Webview容器 -->
            <div class="webview-container" id="webview-container">
                <!-- 这里将加载各个模块的HTML页面 -->
            </div>
        </div>
    </div>
    
    <script src="js/components/sidebar.js"></script>
    <script>
        // 全局变量
        let sidebar;
        let pageManager;
        
        // 页面初始化
        document.addEventListener('DOMContentLoaded', function() {
            // 初始化侧边栏
            sidebar = new Sidebar();
            window.sidebar = sidebar;
            
            // 初始化页面管理器
            pageManager = new PageManager();
            window.pageManager = pageManager;
            
            // 默认加载仪表盘
            pageManager.loadPageInWebview('dashboard');
            
            // 认证检查
            checkAuth();
        });
        
        // 工具函数
        function refreshCurrentModule() {
            if (pageManager && pageManager.currentWebview) {
                if (pageManager.currentWebview.tagName === 'IFRAME') {
                    pageManager.currentWebview.src = pageManager.currentWebview.src;
                } else {
                    // 重新加载当前页面
                    pageManager.loadPageInWebview(sidebar.currentPage);
                }
            }
        }
        
        function toggleFullscreen() {
            if (!document.fullscreenElement) {
                document.documentElement.requestFullscreen();
            } else {
                document.exitFullscreen();
            }
        }
        
        // 认证检查
        async function checkAuth() {
            try {
                // 这里可以添加实际的认证检查逻辑
                // const response = await fetch('/api/console/auth/check');
                console.log('认证检查通过');
            } catch (error) {
                console.warn('认证检查失败，跳转到登录页面');
                // window.location.href = '/login.html';
            }
        }
    </script>
</body>
</html>